#include <cstdio>
#include <algorithm>
#include <cstring>
#include <queue>
using namespace std;
const int N=100050;
const int M=500050;
int n,m,t;
struct Edge{
    int u,v,next;
}edge[M];
int cnt;
int head[N];
int u,v;
int ind[N],topo[N];
void init(){
    cnt=0;
    memset(head,-1,sizeof(head));
    memset(topo,-1,sizeof(topo));
    memset(ind,0,sizeof(ind));
}
void addEdge(int u,int v){
    edge[cnt]=Edge{u,v,head[u]};
    head[u]=cnt++;
    ind[v]++;
}
void toposort(){   
    int k=1;
    priority_queue<int> q;
    for(int i=1;i<=n;i++){
        if(ind[i]==0){
            q.push(i);
        }
    }
    while(!q.empty()){
        int u=q.top();
        q.pop();
        ind[u]=-1;
        topo[k++]=u;
        for(int i=head[u];i!=-1;i=edge[i].next){
            int v=edge[i].v;
            ind[v]--;
            if(ind[v]==0){
                q.push(v);
            }
        }
    }
}
int main(void){
    scanf("%d",&t);
    while(t--){
        init();
        scanf("%d%d",&n,&m);
        for(int i=0;i<m;i++){
            scanf("%d%d",&u,&v);
            addEdge(u,v);
        }
        toposort();
        bool flag=true;
        for(int i=1;i<=n;i++){
            //printf("%d\n",topo[i]);
            if(topo[i]==-1){
                flag=false;
                break;
            }
        }
        if(flag){
            printf("Correct\n");
        }
        else{
            printf("Wrong\n");
        }
    }
    return 0;
}